//
//  NSDateFormatter+ZLCategory.m
//  ZLCategory
//
//  Created by zhaozl on 2022/3/7.
//

#import "NSDateFormatter+ZLCategory.h"

@implementation NSDateFormatter (ZLCategory)

/// 时间格式单例
/// @param format 时间格式  例如 'yyyyMMdd'
+ (NSDateFormatter *)zl_dateFormatterWithFormat:(NSString *)format {
    NSDateFormatter *dateFormat = [NSDateFormatter dateFormatter];
    [dateFormat setDateFormat:format];
    return dateFormat;
}

+ (NSDateFormatter *)dateFormatter {
    static NSDateFormatter *_df;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _df = [[NSDateFormatter alloc]init];
    });
    return _df;
}

@end
